<template>
  <div>
    <HomePanel title="新鲜好物" sub-title="新鲜出炉 品质靠谱">
      <template #right>
        <XtxMore></XtxMore>
      </template>

      <template #default>
        <ul ref="pannel" class="goods-list">
          <li v-for="item in list" :key="item.id">
            <RouterLink to="/">
              <!-- <img :src="item.picture" alt="" /> -->
              <img v-imgLazy="item.picture" alt="" />
              <p class="name">{{ item.name }}</p>
              <p class="price">&yen;{{ item.price }}</p>
            </RouterLink>
          </li>
        </ul>
      </template>
    </HomePanel>
  </div>
</template>

<script>
import HomePanel from './home-panel'
import { reqFindNew } from '@/api/home'
import { ref } from 'vue'
export default {
  components: {
    HomePanel
  },
  setup () {
    const list = ref([])
    const getList = async () => {
      const res = await reqFindNew()
      console.log(res, 2)
      list.value = res.result
    }
    getList()
    return { list }
  }
}
</script>
<style scoped lang="less">
.goods-list {
  display: flex;
  justify-content: space-between;
  height: 406px;
  li {
    width: 306px;
    height: 406px;
    background: #f0f9f4;
    img {
      width: 306px;
      height: 306px;
    }
    p {
      font-size: 22px;
      padding: 12px 30px 0 30px;
      text-align: center;
      text-overflow: ellipsis;
      overflow: hidden;
      white-space: nowrap;
    }
    .price {
      color: @priceColor;
    }
  }
}
</style>
